<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include('../include/dbFunctions.php');
    $_SESSION['mes']="";
//Retrieve data from AJAX data sent by jEditable
    $admin_name = htmlspecialchars($_POST['admin_name'],ENT_QUOTES);
    $admin_email = htmlspecialchars($_POST['admin_email'],ENT_QUOTES);
    $admin_password = SHA1("PASSW0RD");
    $admin_role="moderator";

    $query1 = 'INSERT INTO quanly(admin_name,admin_email,admin_password,admin_role)
VALUES ("'.$admin_name.'","'.$admin_email.'","'.$admin_password.'","'.$admin_role.'")';
    $result1 = executeQuery($query1);
   if ($result1!=0) {
        $_SESSION['mes'] = "New admin has been added successfully.";
    } else {
        $_SESSION['mes'] = "Error! Please try again";
    }$link = "../include/adminaccount.php";
    header("Location: $link ");

}else {
    header("Location: ../../include/login.html");
}
?>
